

/*Prepared Using STATA 16: September 16, 2023*/
/*Use STATA 16, create folders for Tables and Figures in main central director
install ritest, outreg2, codebookout, and tabout to run
net install ritest.pkg
net install outreg2.pkg
net install tabout.pkg
ssc install codebookout
net install estout*/

/*NOTES: Create subfiles to store \Figures & \Tables
Because of main log, individual logs within do file for recording randomization inference p-values and WestFall-Young p-values had to be commented out.
We recommend putting them back in for ease of replication.*/

/*Documents
0_Manuscript: Anonymous manuscript submitted to JOP with main figures and tables
0_Online Appendix: Online appendix with supplemental analyses.*/

/*Do Files
2_VNA_Master.do: Master .do file that runs all subsequent.do file from raw data to main analysis
3_VNA_Setup.do: .do file which open raw data, merges in supplementary datasets, translated Vietnamese variables, generates new variables, and provides coding and labels
4_VNA_Main.do: .do file that generates main figures and tables and other important numbers in body of manuscript
5_VNA_AppendixACDEFGHI & 6_VNA_AppendixJKL.do: do files that generates all tables and figures for Supplementary Information (web appendix file)*/


/*Datasets
10_Final data - all phases v2.dta: Raw data from baseline and endline surveys
9_election_working.dta: Working data created by set-up do file that is used in main and appendix analysis
11_Undergrad major recoded.dta: Dataset to Merge: Major of Undergraduate Respondents
12_Questionnaire_order.dta: Dataset to Merge: Data to test impact of miscoded filtering pattern
13_ElectoralDistrictsV2.dta: Dataset to Merge: Data to test subgroup effects by electoral district
14_region.dta: Region of country coding crosswalk
*/

/*Codebook and Log
7_Codebook_ElectionWorking: Codebook created for Final election_working.dta
8_ReplicationLog run on August 25th. 
*/


cap cd "C:\Users\ejm5\Dropbox\Vietnam Election project\2021_Election\Replication"
log using 8_ReplicationLog.smcl, replace

/*Create subfiles for \Figures & \Tables*/

/*************************************************************************************************/
/*Set-up: Coding and Labeling of Variables to Crate Working Data
Merge in other data sets: Line 7
Relabeling of intercept data phase 1: Line 17
Generate intercept variables used in random assignment: Line 53
Recoding and relabeling of endline survey data: Line 135
Creation of election_working.dta: Line 585
Creation of codebook: Line 586
*/
do 3_VNA_Setup.do
/*************************************************************************************************/

/*************************************************************************************************/
/*Main: Main Analysis in Paper
Table 1: Line 7
Table 2: Line 13
Figure 2: Line 44
Table 3: Line 55
Figure 3: Line 75
Figure 4: Line 96*/
do 4_VNA_Main.do
/*************************************************************************************************/

/*************************************************************************************************/
/*Appendices: Appendices C, D, E, F G, H, I 
Appendix A21:Line 7
Appendix A22: Line 14
Appendix C: Line 17
Appendix D: Line 52
Appendix E: Line 56
Appendix F1: Line 66
Appendix F2: Line 70
Appendix G (Hard coded): Line 110
Appendix H: Line 121*/
do 5_VNA_AppendixACDEFGHI.do
/*************************************************************************************************/

/*************************************************************************************************/
/*Appendices: Appendices J, K, & L 
Appendix J: Line 8
Appendix K1: Line 26
Appendix K2: Line 47
Appendix K3: Line 62
Appendix L1: Line 73
Appendix L2: Line 103
Appendix L3: Line 133
Appendix L4: Line 163
*/
do 6_VNA_AppendixJKL.do
/*************************************************************************************************/
log close
